package com.pmpd.activity.controller.rpc;

import com.pmpd.activity.service.background.BgHotActivityTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * \* User: helei
 * \* Date: 22/06/18
 * \* Description:
 * \
 */
@Api(value = "个人数据服务系统/rpc热门活动API", description = "个人数据服务系统/rpc热门活动API")
@RestController
@RequestMapping(value = "/rpc/pmpd-activity-server/v1/activity/hotActivityTag/")
public class BgHotActivityTagController {

    @Resource
    private BgHotActivityTagService bgHotActivityTagService;

    @ResponseBody
    @ApiOperation(value = "根据tagId 统计该标签关联活动数量", notes = "1. 必填： tagId;")
    @RequestMapping(value = "select/countByTagId", method = RequestMethod.GET)
    public int countByTagId(@RequestParam String tagId) {
        if (StringUtils.isBlank(tagId) || !StringUtils.isNumeric(tagId) || Long.valueOf(tagId).equals(0L)) {
            return 0;
        }
        return bgHotActivityTagService.countByTagId(Long.valueOf(tagId));
    }

}